package org.phmanago.core;

import java.util.Iterator;
import java.util.LinkedList;
import org.phmanago.utils.ResourceManager;

public abstract class Node {
	protected LinkedList<Attribute> attrs;
	
	protected String nodeName = null;
	
	public Node() {
		nodeName = ResourceManager.getKey("NodeName"); 
	}
	
	public Node(String n) {
		nodeName = n;
	}
	
	public void addAttribute(Attribute a) {
		if (attrs == null)
			attrs = new LinkedList<Attribute>();
		attrs.add(a);
	}
	
	public Iterator getIterator() {
		return attrs.iterator();
	}
	
	public String toString() {
		String s = "";
		
		s += "[" + nodeName + "] "; 
		/*Iterator it = this.getIterator();
		while (it.hasNext()) {
			Attribute attr = (Attribute)it.next();
			s += attr.toString() + " ";
		}*/
		
		return s;
	}
	
	public String getName() {
		return nodeName;
	}
}
